import "./uni.webview.1.5.4.js";
import { createApp } from "vue";
import "vant/lib/index.css";
// Toast
import "vant/es/toast/style";

// Dialog
import "vant/es/dialog/style";

// Notify
import "vant/es/notify/style";

// ImagePreview
import "vant/es/image-preview/style";

import App from "./App.vue";
import vant, { Loading } from "vant";
// import  from "vant";
// import "./assets/styles/vant-theme.scss";
import "./assets/styles/index.scss";
import "virtual:svg-icons-register";

// 注册全局组件
import SvgIcon from "@/components/SvgIcon";
import TheNavBar from "@/components/TheNavBar";
import DateTimePicker from "@/components/DateTimePicker";
import TheLoading from "@/components/TheLoading/loading";
import ToolsBar from "@/components/ToolsBar";
import Filter from "@/components/Filter";
import DEDict from "@/components/DEDict";
import DEStepper from '@/components/DEStepper'
import DePicker from "@/components/DePicker";
import { VueSpinnersPlugin } from 'vue3-spinners';
// 导入router配置文件
import router from "./router";
import "./permissions";
// 导入pinia
import { createPinia } from "pinia";
import piniaPluginPersist from 'pinia-plugin-persist'
import loadingDirective from "./directives/loading.js";
const store = createPinia();
store.use(piniaPluginPersist);


const app = createApp(App);

app.use(router);
app.use(vant);
app.use(store);
app.use(VueSpinnersPlugin);
// 手动注册 Vant 的 Loading 组件（避免全局注册整个 Vant）
app.component('van-loading', Loading);
app.directive('loading', loadingDirective);
app.component("SvgIcon", SvgIcon);
app.component("TheNavBar", TheNavBar);
app.component("DateTimePicker", DateTimePicker);
app.component("ToolsBar", ToolsBar);
app.component("Filter", Filter);
app.component("DEDict", DEDict);
app.component("DEStepper", DEStepper);
app.component("DePicker", DePicker);
app.provide("the-loading", TheLoading);


app.mount("#app");

window.addEventListener('popstate', function () {
  // history.pushState(null, null, document.URL)
  window.history.forward()
})
